@echo off
REM This script opens a new CMD window and executes MsSqlSync2MySQL.exe with the specified configuration file in the same directory as the script

REM Get the directory of the current script
SET SCRIPT_DIR=%~dp0

REM Define the path to the executable and the configuration file based on the script directory
SET EXECUTABLE_PATH="%SCRIPT_DIR%MsSqlSync2MySQL.exe"
SET CONFIG_FILE="%SCRIPT_DIR%example.yml"

REM Check if the executable exists
IF NOT EXIST %EXECUTABLE_PATH% (
    ECHO Error: MsSqlSync2MySQL.exe not found at %EXECUTABLE_PATH%
    EXIT /B 1
)

REM Check if the configuration file exists
IF NOT EXIST %CONFIG_FILE% (
    ECHO Error: Configuration file %CONFIG_FILE% not found
    EXIT /B 1
)

REM Construct the command to run in a new CMD window
SET CMD_TO_RUN="%EXECUTABLE_PATH% --config %CONFIG_FILE%"

REM Open a new CMD window and execute the command
START CMD /K %CMD_TO_RUN%

EXIT /B 0
